package com.qianyu.project.web.controller.base;

import com.qianyu.project.utils.Result;
import com.qianyu.project.utils.ResultTool;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author gs
 * @date create in 2021/1/2 12:47
 */
@RestControllerAdvice
public class BaseControllerAdvice {

    @ExceptionHandler(Exception.class)
    public Result exceptionHandler(Exception exception){
        exception.printStackTrace();
        return ResultTool.failure(exception.getMessage());
    }
}
